<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html 
     PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>Module: ActsCrummy::BreadcrumbsHelper</title>
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  <meta http-equiv="Content-Script-Type" content="text/javascript" />
  <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
  <script type="text/javascript">
  // <![CDATA[

  function popupCode( url ) {
    window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
  }

  function toggleCode( id ) {
    if ( document.getElementById )
      elem = document.getElementById( id );
    else if ( document.all )
      elem = eval( "document.all." + id );
    else
      return false;

    elemStyle = elem.style;
    
    if ( elemStyle.display != "block" ) {
      elemStyle.display = "block"
    } else {
      elemStyle.display = "none"
    }

    return true;
  }
  
  // Make codeblocks hidden by default
  document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
  
  // ]]>
  </script>

</head>
<body>



    <div id="classHeader">
        <table class="header-table">
        <tr class="top-aligned-row">
          <td><strong>Module</strong></td>
          <td class="class-name-in-header">ActsCrummy::BreadcrumbsHelper</td>
        </tr>
        <tr class="top-aligned-row">
            <td><strong>In:</strong></td>
            <td>
                <a href="../../files/lib/breadcrumbs_helper_rb.html">
                lib/breadcrumbs_helper.rb
                </a>
        <br />
            </td>
        </tr>

        </table>
    </div>
  <!-- banner header -->

  <div id="bodyContent">



  <div id="contextContent">

    <div id="description">
      <p>
This module is mixed into ActionView::Base to provide the ability to render
breadcrumbs using the structure from the models.
</p>

    </div>


   </div>

    <div id="method-list">
      <h3 class="section-bar">Methods</h3>

      <div class="name-list">
      <a href="#M000001">render_breadcrumbs</a>&nbsp;&nbsp;
      </div>
    </div>

  </div>


    <!-- if includes -->

    <div id="section">


    <div id="constants-list">
      <h3 class="section-bar">Constants</h3>

      <div class="name-list">
        <table summary="Constants">
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">DEFAULT_BREADCRUMB_SEPARATOR</td>
          <td>=</td>
          <td class="context-item-value">' &amp;gt; '</td>
        </tr>
        </table>
      </div>
    </div>



      


    <!-- if method_list -->
    <div id="methods">
      <h3 class="section-bar">Public Instance methods</h3>

      <div id="method-M000001" class="method-detail">
        <a name="M000001"></a>

        <div class="method-heading">
          <a href="#M000001" class="method-signature">
          <span class="method-name">render_breadcrumbs</span><span class="method-args">(child, options = {})</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Renders breadcrumbs up the model hierarchy starting with <tt>child</tt>,
creating a link for each item, and returning the result as a string. It
works by selecting the return value of the method parent from each model
object. Each parent value is expected to be an instance of a model so that
a link can be rendered. As a convenience, the method
ActiveRecord::Base.is_child_to is provided so that the existing model does
not need to be altered to use breadcrumbs.
</p>
<p>
The only allowable currently is <tt>:level</tt>, which is an optional
integer to limit the number of parent links displayed to.
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000001-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000001-source">
<pre>
    <span class="ruby-comment cmt"># File lib/breadcrumbs_helper.rb, line 19</span>
19:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">render_breadcrumbs</span> <span class="ruby-identifier">child</span>, <span class="ruby-identifier">options</span> = {}
20:       <span class="ruby-identifier">i</span>, <span class="ruby-identifier">level</span> = <span class="ruby-value">0</span>, (<span class="ruby-identifier">options</span>[<span class="ruby-identifier">:level</span>] <span class="ruby-operator">||</span> <span class="ruby-value">-1</span>)
21:       <span class="ruby-identifier">urls</span> = [<span class="ruby-identifier">describe_model</span>(<span class="ruby-identifier">child</span>)]
22:       <span class="ruby-identifier">parent</span> = <span class="ruby-identifier">child</span>
23: 
24:       <span class="ruby-keyword kw">while</span> <span class="ruby-identifier">parent</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">:parent</span>) <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">i</span> <span class="ruby-operator">!=</span> <span class="ruby-identifier">level</span> <span class="ruby-operator">&amp;&amp;</span> (<span class="ruby-identifier">parent</span> = <span class="ruby-identifier">parent</span>.<span class="ruby-identifier">parent</span>)
25:         <span class="ruby-identifier">i</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span>
26:         <span class="ruby-comment cmt"># if block_given?</span>
27:         <span class="ruby-identifier">urls</span>.<span class="ruby-identifier">unshift</span>(<span class="ruby-identifier">parent_link</span>(<span class="ruby-identifier">parent</span>, <span class="ruby-identifier">options</span>))
28:         <span class="ruby-comment cmt"># else</span>
29:         <span class="ruby-comment cmt">#   urls.unshift(parent_link(parent))</span>
30:         <span class="ruby-comment cmt"># end          </span>
31:       <span class="ruby-keyword kw">end</span>
32: 
33:       <span class="ruby-identifier">urls</span>.<span class="ruby-identifier">join</span>(<span class="ruby-identifier">options</span>[<span class="ruby-identifier">:separator</span>] <span class="ruby-operator">||</span> <span class="ruby-constant">DEFAULT_BREADCRUMB_SEPARATOR</span>)
34:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>


    </div>


  </div>


<div id="validator-badges">
  <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>

</body>
</html>